package main

import "fmt"

type Cat struct {
	Name  string
	Color string
}

func NewCatByName(name string) *Cat {
	return &Cat{
		Name: "hah",
	}
}

func NewCatByColor(color string) *Cat {
	return &Cat{
		Color: "lve",
	}
}

type BlackCat struct {
	Cat
}

func NewCat(name string) *Cat {
	return &Cat{
		Name: name,
	}
}

func NewBlackCat(color string) *BlackCat {
	cat := &BlackCat{}
	cat.Color = color
	return cat
}

func main() {
	cat := NewCatByName("小白")
	fmt.Println(cat.Name)
	colorcat := NewCatByColor("black")
	fmt.Println(colorcat.Color)

	blackCat := NewBlackCat("white")
	fmt.Println(blackCat.Color)
}
